package com.twu.biblioteca;

import java.io.IOException;
import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 * User: thoughtworker
 * Date: 10/14/13
 * Time: 1:07 PM
 * To change this template use File | Settings | File Templates.
 */
public class ValidateInMap {

    private Map<String, Command> optionsMap;

    public ValidateInMap(Map<String, Command> optionsMap) {
        this.optionsMap = optionsMap;
    }

    public void mapToMenu(String userMenuChoice) throws IOException {
        if(optionsMap.keySet().contains(userMenuChoice)){
            optionsMap.get(userMenuChoice).execute();
        }else{
            optionsMap.get("Invalid").execute();
        }
    }


}
